/* 
 * File:   FalsePositiveRemover.h
 * Author: Guilherme Monteiro
 *
 */

#ifndef FALSEPOSITIVEREMOVER_H
#define	FALSEPOSITIVEREMOVER_H

#include <vector>
#include <cv.h>
#include <cxcore.h>
#include <algorithm>

#include "Line.h"
#include "ROI.h"
#include "Cell.h"
#include "ImageHistogramBasedOnProjectionCreator.h"
#include "ROI.h"
#include "Cell.h"

using namespace std;

class FalsePositiveRemover {
public:
    FalsePositiveRemover(ROI* roi, vector<Cell> cells);
    FalsePositiveRemover(const FalsePositiveRemover& orig);
    virtual ~FalsePositiveRemover();
    vector<Cell> removeInvalidBorders();
private:
    ROI* roi;
    vector<Cell> cells;
    
    static int const FLAG_TO_INVALID_BORDER = -1;
    Line* invalidBorder;
    
    void setInvalidBorder(Line* line);
    Cell validateBorders(Cell cell, vector<int> horizontalProjection, vector<int> verticalProjection);
    IplImage* getCellContent(IplImage* imageROI, Cell cell);
};

#endif	/* FALSEPOSITIVEREMOVER_H */

